import java.util.*;
public class Main
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        long a = in.nextInt(), h = in.nextInt(), b = in.nextInt(), k = in.nextInt();

        long ret = 0;
        // 1. 计算能够互砍多少回合
        long n = Math.min(h / b, k / a);
        ret += n * (a + b);

        // 2. 计算剩余⾎量
        h -= n * b;
        k -= n * a;
        // 3. 判断是否都还活着
        if(h > 0 && k > 0) {
        h -= b;
        k -= a;
        ret += a + b;
    }

    // 4. 判断是否会放⼤
        if(h > 0 || k > 0) {
            ret += 10 * (h > 0 ? a : b);
        }
        System.out.println(ret);
    }
}


